<template>
  <div class="not-found">
    <div class="content">
      <div class="error-container">
        <div class="error-code">
          <span>4</span>
          <div class="zero-container">
            <div class="zero">
              <div class="book-container">
                <div class="book book1"></div>
                <div class="book book2"></div>
                <div class="book book3"></div>
              </div>
            </div>
          </div>
          <span>4</span>
        </div>
        <h1 class="error-title">页面不见了</h1>
        <p class="error-message">抱歉，您访问的页面可能被借走了...</p>
        <div class="actions">
          <el-button type="primary" size="large" @click="goHome">
            <el-icon>
              <Back />
            </el-icon>返回首页
          </el-button>
          <el-button size="large" @click="goBack">
            <el-icon>
              <ArrowLeft />
            </el-icon>返回上一页
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { Back, ArrowLeft } from '@element-plus/icons-vue'

const router = useRouter()

const goHome = () => {
  router.push('/home')
}

const goBack = () => {
  router.back()
}
</script>

<style scoped>
.not-found {
  width: 100vw;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e7eb 100%);
  padding: 20px;
}

.content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.error-container {
  padding: 40px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease-out;
}

.error-code {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 120px;
  font-weight: bold;
  color: #409EFF;
  margin-bottom: 24px;
}

.zero-container {
  width: 120px;
  height: 120px;
  position: relative;
  margin: 0 8px;
  animation: rotate 10s linear infinite;
}

.zero {
  width: 100%;
  height: 100%;
  border: 12px solid #409EFF;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}

.book-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  animation: counterRotate 10s linear infinite;
}

.book {
  position: absolute;
  width: 20px;
  border-radius: 2px;
  background: #409EFF;
  transform-origin: center;
}

.book1 {
  height: 40px;
  transform: rotate(0deg) translateX(20px);
}

.book2 {
  height: 35px;
  transform: rotate(120deg) translateX(20px);
}

.book3 {
  height: 30px;
  transform: rotate(240deg) translateX(20px);
}

.error-title {
  font-size: 32px;
  color: #303133;
  margin: 0 0 16px;
  font-weight: 600;
}

.error-message {
  font-size: 18px;
  color: #606266;
  margin: 0 0 32px;
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

:deep(.el-button) {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes counterRotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(-360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-code {
    font-size: 80px;
  }

  .zero-container {
    width: 80px;
    height: 80px;
  }

  .error-title {
    font-size: 24px;
  }

  .error-message {
    font-size: 16px;
  }

  .actions {
    flex-direction: column;
  }

  :deep(.el-button) {
    width: 100%;
  }
}
</style>